package com.yihu.yihuds.service;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import com.yihu.dataService.hessian.resource.ResourceMongoDBManager;
import com.yihu.web.bean.OrdersList;
import com.yihu.web.bean.order.Order;
import com.yihu.web.bean.vo.OrderQuery;
import com.yihu.web.constats.ResponseVO;
import com.yihu.web.dataService.hessian.interfaceService.OrderHService;


public class OrderService{
	OrderHService service = null;
	public OrderService(){
		try {
			service= (OrderHService)ResourceMongoDBManager
					.getSingleton().getBeans("orderHSC");
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	public Object findByPage(OrderQuery query){
		return service.findByPage(query);
	}
	
	public Object getById(String id){
		return service.get(id);
	}
	
	public Object getByOrderNo(String orderNo){
		Order order = new Order();
		order.setOrderNo(orderNo);
		return service.getOrder(order);
	}
	
	public Object getOrder(Order order){
		return service.getOrder(order);
	}

	public Object updateOrder(Order order){
		return service.updateOrder(order);
	}
	
	public Object changePrice(Order order){
		return service.changePrice(order);
	}
	
	public Map<String, Object> addOrder(Order order){
		return service.add(order);
	}
	
	public Object paySuccess(Order order){
		return service.paySuccess(order);
	}
	
	public Object changeState(Order order){
		return service.changeState(order);
	}
	public List<Order> batchCancelOrder(int hour){
		return service.batchSchedulerCancelOrder(hour);
	}
	
	public List<Order> refundOrders(int hour){
		return service.refundOrders(hour);
	}
	
	public Object getExpressFromRedis(String expressNo){
		return service.getExpressFromRedis(expressNo);
	}
	public Object setExpressFromRedis(String expressNo,String expressInfo){
		return service.settExpressToRedis(expressNo, expressInfo);
	}
	public Object refund(Order order){
		return service.refund(order);
	}
	//审核退款
	public Object refundCancel(Order order){
		return service.refundCancel(order);
	}
	public Object cancelOrder(Order order){
		return service.cancelOrder(order);
	}
	public Order delete(Order order){
		return service.delete(order);
	}
	
	/**
	 * 获取订单的优惠详情
	 * @param order
	 * @return
	 */
	public Object getCouponDetailByArtwork(Order order){
		return service.getCouponDetailByArtwork(order);
	}
	public Object getOrdersForFront(OrderQuery query){
		return service.getOrdersForFront(query);
	}
	
	public ResponseVO getOrderCount(OrderQuery query){
		return service.getOrderCount(query);
	}
	public ResponseVO batchCancelOrder(OrdersList ordersList){
		return service.batchCancelOrder(ordersList);
	}
	
	
}
